<#include "../../common/header.htm">
<div class="content-wrapper">
	<section class="content" id="planDialog" style="display: flex;">
		<form  method="post" class="form-horizontal" style="width: 500px;">
			<div class="form-group">
				<label class="col-sm-3 control-label">机场名称：</label>
				<div class="col-sm-8 casexiaqu">
					<input v-model="planeName"  class="form-control easyui-validatebox"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">机场别名：</label>
				<div class="col-sm-8 casexiaqu">
					<input v-model="planeAlias"  class="form-control easyui-validatebox"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">所在地：</label>
				<div class="col-sm-8 casexiaqu">
					<input v-model="location"  class="form-control easyui-validatebox"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">机场地址：</label>
				<div class="col-sm-8 casexiaqu">
					<input v-model="planeAddress"  class="form-control easyui-validatebox"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">经度：</label>
				<div class="col-sm-8 casexiaqu">
					<input v-model="jd"  class="form-control easyui-validatebox"/>
				</div>
			</div>
			<div class="form-group">
				<label class="col-sm-3 control-label">维度：</label>
				<div class="col-sm-8 casexiaqu">
					<input v-model="wd"  class="form-control easyui-validatebox"/>
				</div>
			</div>
			<div class="form-group bill-buttonarea"  style="text-align: center;">
				<input type="button" class="btn btn-primary" @click="onSubmit" value="提交" />
			</div>
		</form>
		<div id="map" style="width: 560px;height: 400px">
		</div>
	</section>
</div>
<!--判断是否联网-->
<script src="${ctx}/bower_components/vue/common/onLineUtil.js"></script>
<#if Session["env"]?exists && Session["env"] = 'Intranet'>
<link rel="stylesheet" type="text/css" href="${ctx}/bower_components/map2.0/css/baidu_map_v2.css"/>
<script src="${ctx}/bower_components/map2.0/baidumap_offline_v2_load.js"></script>
<#else>
<script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=T72A6h5INhfXpKA5ZBsrDcj3fbQpeaWs"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/InfoBox/1.2/src/InfoBox_min.js"></script>
<script type="text/javascript" src="http://api.map.baidu.com/library/CurveLine/1.5/src/CurveLine.min.js"></script>
</#if>
<script>
	$(function () {
		var data=top.dialog.get(window).data
		var id=data.id;
		if (id){
			$.ajax({
				url:"${ctx}/plane/findOneById",
				type: "post",
				data: {
					id:id,
				},
				dataType: "json",
				success: function (msg) {
					if (msg.flag) {
						var obj=msg.data;
						vm.planeName=obj.planeName
						vm.planeAlias=obj.planeAlias
						vm.location=obj.location
						vm.planeAddress=obj.planeAddress
						vm.jd=obj.jd,
						vm.wd=obj.wd,
						vm.id=obj.id
						initMap2("map",{"jd":obj.jd,"wd":obj.wd},setJWD)
					}
				},

			})
		}else{
			//初始化地图
			initMap2("map",{},setJWD)
		}
	})
	var vm=new Vue({
		el:"#planDialog",
		data:{
			planeName:"",
			planeAlias:"",
			location:"",
			planeAddress:"",
			jd:"",
			wd:""
		},
		methods:{
			onSubmit(){
				$.ajax({
					url:"${ctx}/plane/save",
					type: "post",
					data: {
						planeName:this.planeName,
						planeAlias:this.planeAlias,
						location:this.location,
						planeAddress:this.planeAddress,
						jd:this.jd,
						wd:this.wd,
						id:this.id
					},
					dataType: "json",
					success: function (msg) {
						if (msg.flag) {
							if (vm.id){
								vm.$message('修改成功');
							} else{
								vm.$message('新增成功');
							}
						}
					},

				})
			},

		}
	})
	//设置经纬度
	function setJWD(jd,wd) {
		vm.jd=jd;
		vm.wd=wd;
	}
</script>
<style>
	.bill-buttonarea .btn{
		background: #4595ec;
		border-color: transparent;
	}
	.bill-buttonarea .btn:hover{
		background: #3296f1;
	}
	.btn-primary:active:focus{
		background: #0c76d7;
	}
	.casetypespan{
		cursor: pointer;
	}
	#caseRemark{
		border-radius: 4px;
		border: solid 1px #d9d9d9;

	}
	sapn.caseperfen {
		margin-left: 25px;
		height: 34px;
		line-height: 34px;
	}
	.col-sm-8{
		padding-left: 0;
	}
	.col-sm-6{
		padding-left: 0;
	}
	#personName{
		width: 527px;
		height: 34px;
		background-color: #ffffff;
		border-radius: 4px;
		border: solid 1px #d9d9d9;
	}
	input#caseAuthority{
		margin-right: 6px;
	}
	input#casePerson {
		margin-right: 6px;
	}
	span.casetypespan {
		margin-right: 35px;
	}
	input#caseType {
		margin-right: 6px;
	}
	.casetypec{
		margin-top: 5px;
	}
	.form-group {
		margin-bottom: 25px;
	}
	span.casestar {
		color: red;
		font-size: 18px;
		position: absolute;
		right: 86px;
		top: 8px;
		font-weight: 900;
	}
	label.col-sm-3.control-label {
		font-weight: normal;
		color: #000;
	}
	.box-body {
		margin-top: 30px;
	}
	.box-body.table-responsive {
		height: 100%;
	}
	.fixed-table-pagination {
		margin-top: 15px;
	}
	.form-control {
		width: 200px;
		height: 34px;
		line-height: 25px;
		background: #fff;
		border-color: #d9d9d9;
		border-radius: 4px;
	}
</style>